<template>
    <div id="creach_header">
        <el-form :inline="true" :model="form_search">
            <el-form-item label="ID">
                <el-input v-model="form_search.id" placeholder="ID" @change="handle_search"></el-input>
            </el-form-item>
            <el-form-item label="标题">
                <el-input v-model="form_search.title" placeholder="标题" @change="handle_search"></el-input>
            </el-form-item>
            <el-form-item label="日期">
                <el-date-picker v-model="form_search.date" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="handle_search">
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="add_news">添加新闻</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
    export default {
        name:'creach_header',
        data() {
            return {
                form_search: {
                    id: '',
                    title: '',
                    date: [],
                }
            };
        },
        methods: {
            // handleSelect(key, keyPath) {
            //     console.log(key, keyPath);
            // },
            handle_search(){
                this.form_search.date[0] = new Date(this.form_search.date[0]).getTime();
                this.form_search.date[1] = new Date(this.form_search.date[1]).getTime();

                this.$emit('toTableData',this.form_search)

               
            },
            add_news(){
                this.$router.push('add_news');
            }
        }
    }
</script>

<style>

</style>